<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Demo</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
    <div id="app">
        <h3 :style="{fontSize: fontSize + 'px', background: color}">{{msg}}</h3>
        <h3 :style="getStyles()">{{msg}}</h3>
    </div>
    <script>
        var vm = new Vue({
            el: "#app",
            data: {
                msg: "你好啊，我来了~！",
                fontSize: 50,
                color: 'red'
            },
            methods: {
                getStyles: function () {
                    return {fontSize: this.fontSize + 'px', background: this.color};
                }
            }
        })
    </script>
</body>
</html>